package com.jicheng.service.impl;

import com.jicheng.dto.app.AppDataHistoryDto;
import com.jicheng.dto.app.AppDateDto;
import com.jicheng.ext.dto.SearchPagingParams;
import com.jicheng.mapper.AppDataMapper;
import com.jicheng.service.AppDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: AppDataServiceImpl
 * @Description: TODO
 * @author: khz
 * @date: 2020年08月31日 11:41
 */
@Service
public class AppDataServiceImpl implements AppDataService {

    @Autowired
    AppDataMapper appDataMapper;

    @Override
    public List<AppDataHistoryDto> dataList(SearchPagingParams searchPagingParams) {
        List<AppDataHistoryDto> list = appDataMapper.dataList(searchPagingParams);
        return list;
    }

    @Override
    public List<AppDateDto> getAppDataHistory(String appId, String startTime, String endTime) {
        if((startTime!=null &&startTime!="") || (endTime!=null &&endTime!="")){

            List<AppDateDto> list = appDataMapper.getAppDataHistory(appId, startTime + " 00:00:00", endTime + " 23:59:59");
            return list;

        }else {
            List<AppDateDto> list = appDataMapper.getAppDataHistory(appId, startTime, endTime);

            return list;
        }

    }
}
